/*
 *      wall.h
 *      
 *      Copyright 2008 Víctor Manuel Ochoa <kanito8a@gmail.com>
 *      
 *      This program is free software; you can redistribute it and/or modify
 *      it under the terms of the GNU General Public License as published by
 *      the Free Software Foundation; either version 2 of the License, or
 *      (at your option) any later version.
 *      
 *      This program is distributed in the hope that it will be useful,
 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *      GNU General Public License for more details.
 *      
 *      You should have received a copy of the GNU General Public License
 *      along with this program; if not, write to the Free Software
 *      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 *      MA 02110-1301, USA.
 */


#ifndef WALL_H
#define WALL_H

#include "texture.h"

const int MAX_BLOCKS_PER_LINE=50;
const int MAX_BLOCKS_LINES=20;

/*
 * name: Block
 * Structure for walls blocks
 */
typedef struct{
  int blockType; // 0=Square; 1=triangle
  Texture *blockTexture;
  float blockColor[3];
	bool active;
}Block;

/*
 * Class Wall 
 * Allows to us draw 2.5 walls/floors.
 */
class Wall
{
  public:
    Wall();
    virtual ~Wall();
    bool init(const char *_fileName);
    void draw();
  
  private:
    void drawBlock(const Block *_block,
                   float _x,
                   float _y,
                   float _z,
                   float _sizeMod);
    
    Texture m_Texture;
    Log  *m_pLog;
    Block  m_Wall[MAX_BLOCKS_LINES][MAX_BLOCKS_PER_LINE];
    float  m_BlocksSize;
    int    m_LinesNumber;
    int    m_BlocksPerLineNumber;        
};

#endif /* WALL_H */ 
